/*
 *This program aims at understanding the concepts of Exception handling and Arrays. You have to do as instructed in the comments throughout the program.
 * Briefly, Exception handling is done in programs to provide safety for code that may result in errors, for example attempting to read a file which is not existing anymore.
 * Arrays are used to represent a series/range of similar type of data. This data can be integer, string or even instaces of class.
 */
//Create another class called Dog with data and behavior as you have described in your last report.
 class Dog{
	public String name[];
	 
	
	static public void canBark(){
		System.out.println("woof!");
	}
	static public void canSit(){
		System.out.println("sit");
	}
//Create constructor that will initialize the class with values as provided in the constructor arguments.
//** This is wrong. Check again the rules of constructor.
	public void crearDog ( String pepe[]){
		name = pepe;
	}
}


public class Carolina{
//Create the standard main method here.
	public  void main(String[] args) {
		// TODO Auto-generated method stub
	} //Syntax error on token "}", { expected after this token *WHY?? **This is because you are closing main method abruptly and still more code is written afterwards. All executable code should fall in some method, in this case main method. 

	//string[] name = new array {"Toto","Fifi", "Pitchuco"}; *another way of creating the array.

	dogs= new string[3];
	
    dogs[0] = "Toto"; // initialize first element
    dogs[1] = "Fifi"; // initialize second element
    dogs[2] = "Pitchuco";
    
    Dog.crearDog(dogs); // call the constructor.

//Create a try-catch block with following in the try block:
	try {
//call the methods 'canBark' and 'canSit' on all the 3 members of the dogs array.
		Dog.canSit();
		Dog.canBark();
		 

// Display results.
		
		
//		catch the ArrayIndexOutofBounds exception in the catch block and print a message that array has indexed out.
//		note that this message will not be printed on a normal run of your program.
//		It will show up only when you try to go out of bounds of the array, eg. trying to read the fourth member of an array which has only three members.

	} catch (ArrayIndexOutOfBoundsException e) {
	    System.err.println("The array has indexed out ");
	    	    
	} 
	
} //Syntax error, insert "}" to complete ClassBody *WHY?? ***Each opening bracket must have a corresponding closing bracket. Make sure they match in a block like structure. for example:

/*
b1{

}closing b1

b2{
	b3{
	
	}closing b3
}closing b2

*/



